from abc import ABC, abstractmethod
from time import time


class Template(ABC):

    @abstractmethod
    def job(self): ...

    def cal_time(self):
        start = time()
        self.job()
        end = time()
        print(f"耗时：{(end - start) * 1000} ms")


class AA(Template):

    def job(self):
        for i in range(1, 800001):
            pass

class BB(Template):

    def job(self):
        for i in range(1, 900001):
            pass

if __name__ == "__main__":
    a = AA()
    b = BB()
    a.cal_time()
    b.cal_time()